package com.model.common.ui.adapter.city;

import android.content.Context;

import com.lljjcoder.citypickerview.widget.wheel.adapters.AbstractWheelTextAdapter;
import com.model.common.utils.model.city.ProvinceBean;

import java.util.List;

/**
 * Create by Carson on 2022/2/22.
 * 省 --- 适配器
 */
public class ProvinceWheelAdapter extends AbstractWheelTextAdapter {

    private final List<ProvinceBean> items;

    public ProvinceWheelAdapter(Context context, List<ProvinceBean> items) {
        super(context);
        this.items = items;
    }

    @Override
    public CharSequence getItemText(int index) {
        if (index >= 0 && index < items.size()) {
            return items.get(index).getLabel();
        }
        return null;
    }

    @Override
    public int getItemsCount() {
        return items.size();
    }
}
